package com.cn.xcsharp.util;

import com.cn.xcsharp.service.IPublicDataService;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

//获取数据库
@Component
public class StrDbUtils {

    @Resource
    private IPublicDataService Ipds;

    private static StrDbUtils strDbUtils;
    @PostConstruct
    public void init(){
        strDbUtils=this;
        strDbUtils.Ipds=this.Ipds;
    }
    public static String getPassword(String username){
        String password="";
        String sql="select password from S_USERS where NAME='"+username+"'";
        List list=strDbUtils.Ipds.getList(sql);
        Map map=(Map) list.get(0);
        password=map.get("PASSWORD").toString();
        return password;
    }
}
